package com.gxa.service.impl;

import com.gxa.mapper.Level1Mapper;
import com.gxa.pojo.Level1;
import com.gxa.pojo.Level2;
import com.gxa.service.Level1Service;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * @program: saas
 * @description:
 * @author: Tirion
 * @create: 2020-09-24 21:36
 **/
@Service("level1Service")
public class Level1ServiceImpl implements Level1Service {

    @Resource
    Level1Mapper level1Mapper;
    @Override
    @Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT
    ,rollbackFor = Throwable.class)
    public int deleteByPrimaryKey(Integer id) {
        return level1Mapper.deleteByPrimaryKey(id);
    }

    @Override
    @Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT
            ,rollbackFor = Throwable.class)
    public int insertSelective(Level1 record) {
        return level1Mapper.insertSelective(record);
    }

    @Override
    @Transactional(propagation = Propagation.SUPPORTS,isolation = Isolation.DEFAULT
            ,rollbackFor = Throwable.class)
    public Level1 selectByPrimaryKey(Integer id) {
        return level1Mapper.selectByPrimaryKey(id);
    }

    @Override
    @Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT
            ,rollbackFor = Throwable.class)
    public int updateByPrimaryKeySelective(Level1 record) {
        return level1Mapper.updateByPrimaryKeySelective(record);
    }

//    @Override
//    @Transactional(propagation = Propagation.SUPPORTS,isolation = Isolation.DEFAULT
//            ,rollbackFor = Throwable.class)
//    public List<Level1> selectAll() {
//        return level1Mapper.selectAll();
//    }

    @Override@Transactional(propagation = Propagation.SUPPORTS,isolation = Isolation.DEFAULT
            ,rollbackFor = Throwable.class)
    public Level1 selectByName(String name) {
        return level1Mapper.selectByName(name);
    }

    @Override
    @Transactional(propagation = Propagation.SUPPORTS,isolation = Isolation.DEFAULT
            ,rollbackFor = Throwable.class)
    public List<Level2> selectJunior(Integer id) {
        return level1Mapper.selectJunior(id);
    }

    @Override
    @Transactional(propagation = Propagation.SUPPORTS,isolation = Isolation.DEFAULT
            ,rollbackFor = Throwable.class)
    public List<Map<Object,Object>> selectCount() {
        return level1Mapper.selectCount();
    }

    @Override
    @Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT
            ,rollbackFor = Throwable.class)
    public Integer deleteBatch(List<Integer> arr) {
        return level1Mapper.deleteBatch(arr);
    }

}
